package com.itbaizhan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/c3")
public class MyController3 {

    @RequestMapping(value = "/anno1",params = {"username"})
    public String anno1(String username){
        return "baizhan";
    }

    @RequestMapping(value = "/anno2")
    public String anno2(@RequestParam(value = "name",defaultValue = "xujiale") String username){
        System.out.println(username);
        return "baizhan";
    }

    @RequestMapping("/anno3")
    public String anno3(@RequestHeader("user-agent") String userAgent, @CookieValue("JSESSIONID") String sessionId){
        System.out.println(userAgent);
        System.out.println(sessionId);
        return "baizhan";
    }
}
